<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            #v = '';
            constructor(name) {
                this.name = name;
            }
            get newname() {
                // return this.v;
                return this.#v;
            }
            set newname(v){
                // console.log(v);
                // this.v = v;
                this.#v = v;
            }
        }

        let p = new Person('老王');

        p.name = 'xiaoli';
        p.newname = '456';
        // console.log(p.#v);
        // delete p.newname ;

        for(let item in p){
            console.log(item);
        }

        console.log(p.newname);

        console.log(p);



        

    </script>
</body>

</html>